import QtQuick 2.0

import QtQuick.Particles 2.0

Rectangle {
    id: root
    width: 480; height: 240
    color: "#1F1F1F"

    ParticleSystem {
        id: particleSystem
    }

    ImageParticle {
        source: "assets/particle.png"
        system: particleSystem
        color: '#FFD700'
        colorVariation: 0.2
        rotation: 0
        rotationVariation: 45
        rotationVelocityVariation: 15
        entryEffect: ImageParticle.Scale
    }


    Emitter {
        id: emitter
        anchors.left: parent.left
        anchors.verticalCenter: parent.verticalCenter
        width: 1; height: 20
        system: particleSystem
        emitRate: 40
        lifeSpan: 6400
        lifeSpanVariation: 400
        size: 32
        velocity: AngleDirection {
            angle: 0
            angleVariation: 15
            magnitude: 100
            magnitudeVariation: 50
        }
    }

    // M1>>
//    Age {
//        anchors.horizontalCenter: parent.horizontalCenter //水平
//        width: 240; height: 120
//        system: particleSystem
//        advancePosition: true  //当粒子的生命周期到达1200毫秒后,显示一次
//        lifeLeft: 1200
//        once: true  //true 就飞走， false就是停留在上面
//        Tracer {}
//    }
    // <<M1
    //吸引点是pointX pointY  吸引力 strength
//    Attractor {
//        anchors.horizontalCenter: parent.horizontalCenter
//        width: 160; height: 120
//        system: particleSystem
//        pointX: 0
//        pointY: 0
//        strength: 1.0
//        Tracer {}
//    }
    //
//    Friction {
//        anchors.horizontalCenter: parent.horizontalCenter
//        width: 240; height: 120
//        system: particleSystem
//        factor : 0.8
//        threshold: 25
//        Tracer {}
//    }

//    Gravity {
//        width: 240; height: 240
//        system: particleSystem
//        magnitude: 50  //梯度50
//        angle: 90   //重力方向90垂直
//        Tracer {}
//    }
      //strength定义了矢量对于粒子运动的影响有多大。
//    Turbulence {
//        anchors.horizontalCenter: parent.horizontalCenter
//        width: 240; height: 120
//        system: particleSystem
//        strength: 100
//        Tracer {}
//    }

    //漂移
    Wander {
        anchors.horizontalCenter: parent.horizontalCenter
        width: 240; height: 120
        system: particleSystem
        affectedParameter: Wander.Position
        pace: 200
        yVariance: 240
        Tracer {}
    }

}
